home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbpacket.zip
/
METRIC.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-10-07
|
1KB
|
52 lines
REM METRIC CONVERSION PROGRAM (METRIC.BAS)
REM-This program uses the DATA and READ
REM-statements to initialize arrays for
REM-metric conversion.
REM-Initialize the arrays
Slct = 1
N = 3
DIM M$(N), Q$(N), A$(N), B$(N), F(N)
REM-Data for arrays
DATA " 1 Inches to centimeters"
DATA "Enter inches","inches","centimeters",2.54
DATA " 2 Pounds to kilograms"
DATA "Enter pounds","pounds","kilograms",.4536
DATA " 3 Quarts to liters"
DATA "Enter quarts","quarts","liters",.9463
REM-Read the arrays
FOR I = 1 TO N
READ M$(I), Q$(I), A$(I), B$(I), F(I)
NEXT
DO
REM-Display the menu
PRINT : PRINT "Metric Conversion Program": PRINT
FOR I = 1 TO N
PRINT M$(I)
NEXT I
PRINT N + 1; " To end the program"
REM-Enter the selection
INPUT "Enter the number for your selection"; Slct
IF Slct < 1 OR Slct >= N + 1 THEN EXIT DO
GOSUB Convert
LOOP
PRINT "Program ended"
END
Convert:
REM-Do the conversion
CLS
PRINT : PRINT Q$(Slct);
INPUT X
PRINT X; A$(Slct); " is equal to"; X * F(Slct); B$(Slct)
RETURN